The approaches described in this section could be pursued, but are not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated herein, the approaches described in this section are not prior art to the claims in this application and are not admitted to be prior art by inclusion in this section.
A general-purpose network device, such as a router or a switch for a packet-switched network, may be configured to provide specific services and functions by loading a configuration in the device. Typically devices provide a command-line interface, so that loading a configuration may be performed by entering one or more configuration commands at a console that is coupled to the device, or by loading a previously prepared file that contains a batch of configuration commands. Once entered in the device, the commands are internally parsed by the device, converted into an internal representation in memory or data structures, and executed if necessary. However, to reduce the amount of required storage, the literal text of the configuration command is not stored internally.
The complete configuration of a network device can be lengthy and complex, involving hundreds or thousands of lines of configuration commands. Therefore, network administrators and other users of network devices need a mechanism to cause the network devices to display or output one or more parts of the current configuration.
For example, a network administrator may wish to display the then-current configuration of a particular router interface. In one approach, which is implemented by routers and other devices from Cisco Systems, Inc. that use the Cisco Internetworking Operating System or IOS® software, a “show” command is provided. Entering the “show” command, with one or more arguments or parameters representing an aspect of configuration, causes the IOS® device to re-generate the configuration command that was previously used to establish that aspect of the configuration.
Because the output of the “show” command is configuration command information that is normally displayed or saved in a non-volatile (NV) storage medium, the element of IOS® software that performs command re-generation has been termed an “nvgen” process. Numerous past versions of IOS® software have implemented an “nvgen” process.
However, past approaches for command re-generation have focused on the syntactic structure of the commands that need re-generation. Commands have been re-generated by following a syntax definition for the requested command and retrieving values for each parameter or argument serially as the parameters or arguments are encountered in the syntax definition. If a parameter or argument is used multiple times in different re-generated commands, then multiple retrieval operations have been necessary. Further, there has been no way for external processes to obtain the values of parameters or arguments independent of the re-generation process.
Based on the foregoing, there is a clear need for an improved approach for re-generating commands in network devices.